package de.uhilger.netzpult.client;

import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.resources.client.ClientBundle.Source;
import com.google.gwt.user.client.ui.Tree;


public class TreeBundle implements Tree.Resources {
	
	interface MyImages extends ClientBundle {
	  @Source("img/base.gif")
	  ImageResource base();

	  @Source("img/folder.gif")
	  ImageResource folder();

	  @Source("img/folderopen.gif")
	  ImageResource folderopen();

	  @Source("img/page.gif")
	  ImageResource page();
	}

	final MyImages resources = GWT.create(MyImages.class);
	private boolean showLeafs = false;
	
	
	public TreeBundle() {
		this(false);
	}
	
	public TreeBundle(boolean showLeafs) {
		this.showLeafs = showLeafs;
	}


	@Override
	public ImageResource treeClosed() {
		return resources.folder();
	}

	@Override
	public ImageResource treeLeaf() {
		if(showLeafs) {
			return resources.page();
		} else {
			return resources.folder();
		}
	}

	@Override
	public ImageResource treeOpen() {
		return resources.folderopen();
	}

}
